<?php

class util {
	public static function isWicked($val) {
		$reg = '/[\'.,:;*?~`!@#$%^&+=)(<>{}]|\]|\[|\/|\\\|\"|\|/';
		return preg_match($reg, $val);
	}

	public static function getGet($field, $default = '') {
		return isset($_GET[$field]) ? util::mustFilter($_GET[$field]) : $default;
	}

	public static function mustFilter($val) {
		$ra = array
	    (
	        '/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '/script/', '/javascript/', '/vbscript/', 
	        '/expression/', '/applet/', '/meta/', '/xml/', '/blink/', '/link/', '/style/', '/embed/', 
	        '/object/', '/layer/', '/title/', '/bgsound/', '/base/', '/onload/', '/onunload/',
	        '/onchange/', '/onsubmit/', '/onreset/', '/onselect/', '/onblur/', '/onfocus/', '/onabort/', 
	        '/onkeydown/', '/onkeypress/', '/onkeyup/', '/onclick/', '/ondblclick/', '/onmousedown/', 
	        '/onmousemove/', '/onmouseout/', '/onmouseover/', '/onmouseup/', '/onunload/', '/delete/', 
	        '/insert/', '/update/', '/select/', '/\./', '/\//', '/\'/', '/\"/', '/\:/', '/\%/', '/\$/',
            '/\!/', '/\*/', '/\=/', '/\;/'
	    );
	    $val = preg_replace($ra, '', $val);
	    $val = htmlentities(strip_tags($val));
	    return $val;
	}
}